package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.R;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.domain.NursingProject;
import com.zzyl.nursing.dto.NursingProjectDto;
import com.zzyl.nursing.service.INursingProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import static com.zzyl.common.utils.PageUtils.startPage;

@Api(tags = "老人服务管理")
@RestController
@RequestMapping("/member/orders/project")
public class MemberProjectController extends BaseController {

    @Autowired
    private INursingProjectService nursingProjectService;

    @GetMapping("/page")
    public TableDataInfo<NursingProject> list(@ApiParam("老人服务查询条件") NursingProjectDto nursingProjectDto){
//        NursingProject nursingProject = new NursingProject();
//        BeanUtils.copyProperties(nursingProject, nursingProjectDto);

//        PageHelper.startPage();
//        List<NursingProject> list = nursingProjectService.selectNursingProjectList(nursingProject);
//        return getDataTable(list);
        return nursingProjectService.pageQuery(nursingProjectDto);
    }

    @GetMapping("/{id}")
    public R<NursingProject> getNursingProjectById(@PathVariable("id") Long id){
        return R.ok(nursingProjectService.selectNursingProjectById(id));
    }

}
